import {createRouter, createWebHistory, RouteRecordRaw} from 'vue-router'
import HomeView from '../views/HomeView.vue'

const routes: Array<RouteRecordRaw> = [
    // {
    //     path: '/',
    //     name: 'home',
    //     component: HomeView
    // },
    {
        path: '/about',
        name: 'about',
        // route level code-splitting
        // this generates a separate chunk (about.[hash].js) for this route
        // which is lazy-loaded when the route is visited.
        component: () => import(/* webpackChunkName: "about" */ '../views/AboutView.vue')
    },
    {
        path: '/login',
        name: 'login',
        // route level code-splitting
        // this generates a separate chunk (about.[hash].js) for this route
        // which is lazy-loaded when the route is visited.
        component: () => import(/* webpackChunkName: "about" */ '../views/login/Login.vue')
    },
    {
        path: '/index',
        name: 'index',
        // route level code-splitting
        // this generates a separate chunk (about.[hash].js) for this route
        // which is lazy-loaded when the route is visited.
        component: () => import(/* webpackChunkName: "about" */ '../views/layout/Index.vue')
    },
    {
        path: '/pie',
        name: 'pie',
        // route level code-splitting
        // this generates a separate chunk (about.[hash].js) for this route
        // which is lazy-loaded when the route is visited.
        component: () => import(/* webpackChunkName: "about" */ '../components/Echarts/BarChart.vue')
    },
    {
        path: '/',
        name: '',
        component: () => import('../views/layout/Index.vue'),
        children: [
            {
                path: '/home',
                name: 'home',
                component: () => import(/* webpackChunkName: "about" */ '../views/info/Home.vue')
            },
            {
                path: '/carStock',
                name: 'carStock',
                component: () => import(/* webpackChunkName: "about" */ '../views/carStock/GoodsArea.vue')
            },
            {
                path: '/dict',
                name: 'dict',
                component: () => import(/* webpackChunkName: "about" */ '../views/dict/Dict.vue')
            },
        ]
    },
    {
        path: '/manager',
        name: 'manager',
        component: () => import('../views/layout/Index.vue'),
        children: [
            {
                path: 'dict',
                name: 'dict',
                component: () => import(/* webpackChunkName: "about" */ '../views/dict/Dict.vue')
            },
            {
                path: 'user',
                name: 'user',
                component: () => import(/* webpackChunkName: "about" */ '../views/dict/User.vue')
            },
        ]
    },
    {
        path: '/',
        name: '',
        component: () => import('../views/layout/Index.vue'),
        children: [
            {
                path: '/position',
                name: 'position',
                component: () => import('../views/info/Position.vue')//定位管理
            }, {
                path: '/returnStock',
                name: 'returnStock',
                component: () => import('../views/returnStock/ReturnStockOrder.vue')//退库管理
            }
        ]
    },
    {
        path: '/loading',
        name: 'loading',
        component: () => import('../views/layout/Index.vue'),
        children: [
            {
                path: 'full',
                name: 'full',
                component: () => import('../views/loading/LoadingFull.vue')
            },
            {
                path: 'fullFront',
                name: 'fullFront',
                component: () => import('../views/loading/LoadingFullFront.vue')
            }
        ]
    },
    {
        path: '/deliver',
        name: 'deliver',
        component: () => import('../views/layout/Index.vue'),
        children: [
            {
                path: 'car',
                name: 'car',
                component: () => import('../views/deliver/CarDeliver.vue')
            }
        ]
    },
//    库存
    {
        path: '/products',
        name: 'products',
        component: () => import('../views/layout/Index.vue'),
        children: [
            {
                path: 'stock',
                name: 'stock',
                component: () => import('../views/Product/Stock.vue')
            }
        ]
    },
//    订单
    {
        path: '/order',
        name: 'order',
        component: () => import('../views/layout/Index.vue'),
        children: [
            {
                path: 'createOrder',
                name: 'createOrder',
                component: () => import('../views/order/Order.vue')
            },
            {
                path: 'addProduct',
                name: 'addProduct',
                component: () => import('../views/order/OrderAddProduct.vue')
            },
            {
                path: 'returnOrder',
                name: 'returnOrder',
                component: () => import('../views/order/ReturnOrder.vue')
            },
        ]
    },

    {
        path: '/return/clientHome',
        name: 'clientHome',
        component: () => import('../views/return/ClientHome.vue'),
        children: [
            {
                path: 'myOrder',
                name: 'myOrder',
                component: () => import('../views/return/MyOrder.vue')
            },
            {
                path: 'alreadyOrder',
                name: 'alreadyOrder',
                component: () => import('../views/return/AlreadyOrder.vue')
            },
            {
                path: 'product',
                name: 'product',
                component: () => import('../views/return/Product.vue')
            },
            // 客户
            {
                path: 'Product',
                name: 'Product',
                component: () => import('../views/return/Product.vue')
            },
            // 客户
            {
                path: 'addProduct',
                name: 'addProduct',
                component: () => import('../views/return/AddProduct.vue')
            },
        ]
    },
    {
        path: '/driver',
        name: 'driver',
        component: () => import('../views/driver/Driver.vue'),
        children: [
            {
                path: 'MyOrder',
                name: 'MyOrder',
                component: () => import('../views/driver/MyOrder.vue')
            },
            {
                path: 'AlreadyOrder',
                name: 'AlreadyOrder',
                component: () => import('../views/driver/AlreadyOrder.vue')
            }
        ]
    },

]

const router = createRouter({
    history: createWebHistory(process.env.BASE_URL),
    routes
})

export default router
